﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IsmsExplorer.Infrastructure;
using IsmsExplorer.Model.Iso27001;
using IsmsExplorer.Infrastructure.RepositoryFramework;

namespace IsmsExplorer.Application.Iso27001 {
    public static class Iso27001ControlService {
        private static IUnitOfWork _unitOfWork;
        private static IIso27001ControlRepository _isoControlRepository;

        static Iso27001ControlService() {
            _unitOfWork = new UnitOfWork();
            _isoControlRepository = RepositoryFactory.GetRepository<IIso27001ControlRepository, Iso27001ControlBase>(_unitOfWork);
        }

        public static Iso27001Control FindControlByID(int controlID) {
            return _isoControlRepository.FindControlByID(controlID);
        }

        public static Iso27001Control FindControlByReferenceID(string referenceID) {
            return _isoControlRepository.FindControlByReferenceID(referenceID);
        }

        public static IList<Iso27001ControlSection> FindAllSections(bool recursive) {
            return _isoControlRepository.FindAllSections(recursive);
        }

        public static IList<Iso27001ControlSubsection> FindAllSubsections(Iso27001ControlSection section, bool recursive) {
            return _isoControlRepository.FindAllSubsections(section, recursive);
        }

        public static IList<Iso27001Control> FindAllControls(Iso27001ControlSubsection subsection) {
            return _isoControlRepository.FindAllControls(subsection);
        }

        public static IList<Iso27001Control> FindAllControlsForDocument(int projectID, object documentID) {
            return _isoControlRepository.FindAllControlsForDocument(projectID, documentID);
        }
    }
}
